class CreatePurchases < ActiveRecord::Migration
  def self.up
    create_table :purchases do |t|
      t.references :receipt
      t.references :item
      t.float :quantity
      t.decimal :price, :default => 0, :precision => 5, :scale => 2
      t.decimal :tax_rate, :default => 7, :precision => 4, :scale => 2
      t.boolean :sale
      t.decimal :coupon, :default => 0, :precision => 5, :scale => 2
      t.text :notes

      t.timestamps
    end
  end

  def self.down
    drop_table :purchases
  end
end
